{
 "cells": [
  {
   "cell_type": "code",
   "execution_count": 1,
   "metadata": {
    "collapsed": true,
    "jupyter": {
     "outputs_hidden": true
    }
   },
   "outputs": [],
   "source": [
    "from scilab import *\n",
    "%matplotlib inline"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 2,
   "metadata": {
    "collapsed": true,
    "jupyter": {
     "outputs_hidden": true
    }
   },
   "outputs": [],
   "source": [
    "wid,hig=70,70\n",
    "ini_dens = 0.3"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 3,
   "metadata": {
    "collapsed": true,
    "jupyter": {
     "outputs_hidden": true
    }
   },
   "outputs": [],
   "source": [
    "def isLiving(state, neighbers):\n",
    "    if state==True:\n",
    "        if neighbers<2:\n",
    "            return False\n",
    "        elif neighbers>3:\n",
    "            return False\n",
    "    else:\n",
    "        if neighbers==3:\n",
    "            return True\n",
    "    return state"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 4,
   "metadata": {
    "collapsed": true,
    "jupyter": {
     "outputs_hidden": true
    }
   },
   "outputs": [],
   "source": [
    "cells=np.random.rand(hig,wid)\n",
    "cells=cells < ini_dens\n",
    "cells=cells.astype(int)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 5,
   "metadata": {
    "collapsed": true,
    "jupyter": {
     "outputs_hidden": true
    }
   },
   "outputs": [],
   "source": [
    "def count_neighbers(row,clu):\n",
    "    l,r,u,b=clu-1,clu+2,row-1,row+2\n",
    "    l = l if l>=0 else 0\n",
    "    u = u if u>=0 else 0\n",
    "    nei=cells[u:b,l:r]\n",
    "    return nei.sum()-cells[row,clu]"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 6,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "1"
      ]
     },
     "execution_count": 6,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "count_neighbers(0,8)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 7,
   "metadata": {
    "collapsed": true,
    "jupyter": {
     "outputs_hidden": true
    }
   },
   "outputs": [],
   "source": [
    "def run():\n",
    "    global cells\n",
    "    cells_new=cells.copy()\n",
    "    for r,c in ((r,c) for r in range(hig) for c in range(wid)):\n",
    "        if isLiving(cells[r,c], count_neighbers(r,c)):\n",
    "            cells_new[r,c]=1\n",
    "        else:\n",
    "            cells_new[r,c]=0\n",
    "    \n",
    "    cells=cells_new"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 8,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "array([[0, 1, 1, ..., 0, 0, 0],\n",
       "       [0, 1, 1, ..., 0, 1, 0],\n",
       "       [0, 0, 0, ..., 0, 0, 0],\n",
       "       ..., \n",
       "       [1, 0, 0, ..., 1, 1, 1],\n",
       "       [1, 1, 0, ..., 0, 1, 0],\n",
       "       [0, 0, 0, ..., 0, 0, 0]])"
      ]
     },
     "execution_count": 8,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "run()\n",
    "cells"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 9,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "1457 10\n"
     ]
    },
    {
     "data": {
      "text/plain": [
       "[<matplotlib.lines.Line2D at 0x248f3109978>]"
      ]
     },
     "execution_count": 9,
     "metadata": {},
     "output_type": "execute_result"
    },
    {
     "data": {
      "image/png": "iVBORw0KGgoAAAANSUhEUgAAAXoAAAD3CAYAAAAT+Z8iAAAABHNCSVQICAgIfAhkiAAAAAlwSFlz\nAAALEgAACxIB0t1+/AAAADl0RVh0U29mdHdhcmUAbWF0cGxvdGxpYiB2ZXJzaW9uIDIuMS4wLCBo\ndHRwOi8vbWF0cGxvdGxpYi5vcmcvpW3flQAAIABJREFUeJzt3Xd8lNed7/HPFHWNhIRGJQhJYODQ\nTTOYZkPcSxziFidOud7EaRs7yb033iTOJrt7vRt7s/ZmHW/Wm3WyyTomcWxwD44T29gYsLEpBlEO\nIHqRNIB6b/cPDUIio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fG2PiHa5pwLnl\nrHct8DHg98aYS2n/1TRqGWOygNeAr1trX3e6HidZay87/XE47L9irS12riLHvQN8wxjzCJADJNEe\n/tGqjDPTNaeAGMDnXDmDwy1B/xztZ23rAA9wl8P1OO17QBrwt8aY03P111lro/7FyGhnrX3ZGHMZ\nsIH23+j/2lrb4nBZTvpX4JfGmDW0r0L6nrW2xuGaBpy2KRYRcTm3zNGLiMh5KOhFRFxOQS8i4nIK\nehERl1PQi4i4nIJeRMTlFPQiIi73/wE7Sc4uhwDSjAAAAABJRU5ErkJggg==\n",
      "text/plain": [
       "<matplotlib.figure.Figure at 0x248f2eb2c50>"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    }
   ],
   "source": [
    "cells = np.random.rand(hig,wid)\n",
    "cells = cells < ini_dens\n",
    "cells = cells.astype(int)\n",
    "ini = cells.sum()\n",
    "re=[]\n",
    "cells_last=0\n",
    "for i in range(10):\n",
    "    cells_last=cells\n",
    "    run()\n",
    "    re.append(cells.sum())\n",
    "    if (cells_last==cells).all():\n",
    "        break\n",
    "print(ini,len(re))\n",
    "plot(re)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 10,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "10"
      ]
     },
     "execution_count": 10,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "len(re)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 11,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "[<matplotlib.lines.Line2D at 0x248f31f8d30>]"
      ]
     },
     "execution_count": 11,
     "metadata": {},
     "output_type": "execute_result"
    },
    {
     "data": {
      "image/png": "iVBORw0KGgoAAAANSUhEUgAAAXoAAAD3CAYAAAAT+Z8iAAAABHNCSVQICAgIfAhkiAAAAAlwSFlz\nAAALEgAACxIB0t1+/AAAADl0RVh0U29mdHdhcmUAbWF0cGxvdGxpYiB2ZXJzaW9uIDIuMS4wLCBo\ndHRwOi8vbWF0cGx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v4CQtfaP\nTtcSITJoPxG6DfgK8JQxxuNsSY6qpn3aZhfwX8CjjlYzSNwS9JVAoNNtr7U2qs9ijTGjgTeBJ621\ny52ux0F/BVxljFkNzAD+xxiT7WxJjjoJ/NFa22ittUA9EHS4Jid9i/Z+TKD9Nb5fG2PiHa5pwLnl\nrHct8DHg98aYS2n/1TRqGWOygNeAr1trX3e6HidZay87/XE47L9irS12riLHvQN8wxjzCJADJNEe\n/tGqjDPTNaeAGMDnXDmDwy1B/xztZ23rAA9wl8P1OO17QBrwt8aY03P111lro/7FyGhnrX3ZGHMZ\nsIH23+j/2lrb4nBZTvpX4JfGmDW0r0L6nrW2xuGaBpy2KRYRcTm3zNGLiMh5KOhFRFxOQS8i4nIK\nehERl1PQi4i4nIJeRMTlFPQiIi73/wE7Sc4uhwDSjAAAAABJRU5ErkJggg==\n",
      "text/plain": [
       "<matplotlib.figure.Figure at 0x248ecb41400>"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    }
   ],
   "source": [
    "plot(re)"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## rule30"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 12,
   "metadata": {
    "collapsed": true,
    "jupyter": {
     "outputs_hidden": true
    }
   },
   "outputs": [],
   "source": [
    "from scilab import *\n",
    "%matplotlib inline"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 13,
   "metadata": {
    "collapsed": true,
    "jupyter": {
     "outputs_hidden": true
    }
   },
   "outputs": [],
   "source": [
    "class ruleN:\n",
    "    def __init__(self, iniLine=None, aliveCon=[1,2,3,4], NumGeneration=50, length=None):\n",
    "        self.aliveCon = aliveCon\n",
    "        self.NumGeneration = NumGeneration\n",
    "        length = length or NumGeneration*2 - 1\n",
    "        if iniLine == None:\n",
    "            iniLine = np.zeros(length, dtype=int)\n",
    "            iniLine[int((length+1)/2)]=1\n",
    "        else:\n",
    "            iniLine = array(iniLine)\n",
    "            iniLine = iniLine.astype(bool).astype(int)\n",
    "        self.result = [iniLine]\n",
    "        self.length = len(iniLine)\n",
    "        \n",
    "    def shift(a,n,fill=0):\n",
    "        a = np.roll(a, n)\n",
    "        if n>0:\n",
    "            a[:n]=fill\n",
    "        else:\n",
    "            a[n:]=fill\n",
    "        return a\n",
    "    \n",
    "    def liveCode(a):\n",
    "        s = ruleN.shift\n",
    "        return s(a,-1) + 2*a + 4*s(a,1)\n",
    "    \n",
    "    def nextGeneration(self):\n",
    "        n =  ruleN.liveCode(self.result[-1])\n",
    "        return np.isin(n, self.aliveCon).astype(int)\n",
    "    \n",
    "    def iterition(self):\n",
    "        while len(self.result) < self.NumGeneration:\n",
    "            n = self.nextGeneration()\n",
    "            self.result.append(n)\n",
    "    def show(self):\n",
    "        with sb.axes_style(\"white\"):\n",
    "            plt.imshow(self.result)\n",
    "        plt.show()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 14,
   "metadata": {
    "collapsed": true,
    "jupyter": {
     "outputs_hidden": true
    }
   },
   "outputs": [],
   "source": [
    "r=ruleN()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 15,
   "metadata": {
    "collapsed": true,
    "jupyter": {
     "outputs_hidden": true
    }
   },
   "outputs": [],
   "source": [
    "r.iterition()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 16,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "image/png": "iVBORw0KGgoAAAANSUhEUgAAAW8AAADJCAYAAADsDrNTAAAABHNCSVQICAgIfAhkiAAAAAlwSFlz\nAAALEgAACxIB0t1+/AAAADl0RVh0U29mdHdhcmUAbWF0cGxvdGxpYiB2ZXJzaW9uIDIuMS4wLCBo\ndHRwOi8vbWF0cGxvdGxpYi5vcmcvpW3flQAAEpJJREFUeJzt3V9sVFW7x/HftA0CrZUQ8eIcIqH8\neZX0gmDTaiLVC2vxggsNr0BJNYcrSROoAdJaoa22odQmRtJERRJjQkHwBGK4eW+oxiolk0jEpA3B\nxBhOTgUP/xLbidhpO+dC31Eo3bNnd609e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99/L2XmQSSvC+cOGC1q//Y8//2rVrNTQ0FEa3kbFhwwbt2rUr\n/biwsFDDw8OqrKyUJFVXV2twcDBXw8uJ7u5ubdmyRY888ogk5fX9+Oabb7R69Wo1NDTotdde07PP\nPpu392P58uWanJzU1NSUxsbGVFRUlLf3IpNQgvfY2JhKSkrSjwsLCzUxMRFG15FQXFyskpISjY2N\naefOnWpsbFQqlVIsFks/Pzo6muNRhuf06dNavHhx+j90SXl9P27fvq2hoSEdOnRIb731lvbs2ZO3\n92PhwoUaGRnRCy+8oP3796u+vj5v70UmoeS8S0pKlEgk0o+npqZUVJTzQ3xCdfXqVTU0NKiurk4b\nN25UT09P+rlEIqHS0tIcji5cp06dUiwW0/nz53Xp0iU1NTXp1q1b6efz7X4sWrRIZWVlmjdvnsrK\nyvTAAw/o2rVr6efz6X588sknevrpp7V7925dvXpVr776qpLJZPr5fLoXmYQy8163bp0GBgYkSRcv\nXtTq1avD6DYybty4oe3bt2vv3r3atGmTJGnNmjWKx+OSpIGBgfvWLpirjh07pr6+Ph09elSPP/64\nuru7VV1dnbf344knntDXX3+tVCqlX375Rb/99pueeuqpvLwfpaWlevDBByVJDz30kCYmJvL634qX\nULbH/3u1yQ8//KBUKqUDBw5oxYoVtruNjM7OTv3rX/9SWVlZ+mdvvvmmOjs7lUwmVVZWps7Ozrys\n/VJfX6/29nYVFBRo//79eXs/3nnnHcXjcaVSKb3++utaunRpXt6PRCKhlpYWXb9+XclkUq+88orK\ny8vz8l5kQm0TAHAQiyUBwEEEbwBwEMEbABxE8AYABxG8AcBBBG8AcBDBGwAcRPAGAAf9P0LAMTVP\n6hjfAAAAAElFTkSuQmCC\n",
      "text/plain": [
       "<matplotlib.figure.Figure at 0x248f320fb70>"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    }
   ],
   "source": [
    "r.show()"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## game of life"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 3,
   "metadata": {
    "collapsed": true,
    "jupyter": {
     "outputs_hidden": true
    }
   },
   "outputs": [],
   "source": [
    "from scilab import *\n",
    "%matplotlib inline\n",
    "\n",
    "from PIL import Image"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 4,
   "metadata": {
    "collapsed": true,
    "jupyter": {
     "outputs_hidden": true
    }
   },
   "outputs": [],
   "source": [
    "from partitEquivalence import partitEquivalence"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 5,
   "metadata": {
    "collapsed": true,
    "jupyter": {
     "outputs_hidden": true
    }
   },
   "outputs": [],
   "source": [
    "class lifegame:\n",
    "    \n",
    "    def __init__(self, wordSize=(10,10), ini_dens=0.3, survivalWin=(2,3),\n",
    "                 maxGeneration=1000, partrol_len=(10,20,40), boundaryType=\"circle\"):\n",
    "        \"\"\"\n",
    "        maxGeneration、partrol_len用于控制自动迭代，\n",
    "        maxGeneration 是循环的最大代数，\n",
    "        partrol_len 是检测循环节的每个巡逻兵巡逻的区间长度。sum(partrol_len)是能检测到的最长循环节\n",
    "        boundaryType 边界类型，取值\"circle\",\"zeropadding\"\n",
    "        \"\"\"\n",
    "        self.height, self.width = self.wordSize = wordSize\n",
    "        self.ini_dens = ini_dens\n",
    "        self.survivalWin = survivalWin\n",
    "        cells = np.random.rand(self.height, self.width)\n",
    "        cells = cells < ini_dens\n",
    "        self.cells = cells.astype(int)\n",
    "        self.result = [self.cells.copy()]\n",
    "        self.maxGeneration = maxGeneration\n",
    "        self.patrol = [0] * len(partrol_len)\n",
    "        self.partrol_len = partrol_len\n",
    "        self.patrol_end = array(partrol_len).cumsum()\n",
    "        self.patrol_beg = array((1,)+partrol_len[:-1]).cumsum()\n",
    "        self.period = None\n",
    "        shift_dict = {\"circle\":lifegame.shift_circle,\n",
    "                   \"zeropadding\":lifegame.shift_zeropadding}\n",
    "        self.shift = shift_dict[boundaryType]\n",
    "        \n",
    "    def shift_circle(arr, disp_pairs):\n",
    "        shift = lambda d,r: np.roll(arr,(d,r),axis=(0,1)) \n",
    "        #down-toeards, right-towards\n",
    "        \n",
    "        return [shift(d,r) for d,r in disp_pairs]\n",
    "    \n",
    "    def shift_zeropadding(arr, disp_pairs):\n",
    "        h,w = arr.shape\n",
    "        paded = np.zeros((h+2,w+2), dtype=int)\n",
    "        paded[1:-1,1:-1] = arr\n",
    "        \n",
    "        shift = lambda d,r: paded[-d+1:-d+1+h, -r+1:-r+1+w]\n",
    "        return [shift(d,r) for d,r in disp_pairs]\n",
    "    \n",
    "    def count_neighbers(self):\n",
    "        neighbers = [(1,1),(1,0),(1,-1),(0,1),(0,-1),(-1,1),(-1,0),(-1,-1)]\n",
    "        \n",
    "        return sum(self.shift(self.cells, neighbers))\n",
    "    \n",
    "    def nextGeneration(self):\n",
    "        l,h = self.survivalWin #too low, too high\n",
    "        m = int((h+l)/2+0.5) #just fine\n",
    "        nc = self.count_neighbers()\n",
    "        self.cells[nc<l] = 0\n",
    "        self.cells[nc>h] = 0\n",
    "        self.cells[nc==m] = 1\n",
    "        self.result.append(self.cells.copy())\n",
    "        return self.cells\n",
    "   \n",
    "    def saveGIF(self, fn, duration=250, re=None):\n",
    "        re = re or self.result\n",
    "        saveGIF(fn, re, duration)\n",
    "        \n",
    "    def checkRepetend(self):\n",
    "        \"检测循环节\"\n",
    "        current_i = len(self.result) - 1\n",
    "        for i in range(len(self.patrol)):\n",
    "            p = self.patrol[i]\n",
    "            if current_i - p > self.patrol_end[i]:\n",
    "                self.patrol[i] = p = current_i - self.patrol_beg[i]\n",
    "            if current_i - p < self.patrol_beg[i]:\n",
    "                pass\n",
    "            else:\n",
    "                if np.array_equal(self.result[p],self.result[-1]):\n",
    "                    self.period = current_i - p\n",
    "                    return True\n",
    "                \n",
    "    def iterition(self, n_iter=None):\n",
    "        n_iter = n_iter or self.maxGeneration\n",
    "        self.patrol = [len(self.result) - 1 for _ in self.patrol]\n",
    "        for i in range(n_iter):\n",
    "            self.nextGeneration()\n",
    "            \n",
    "            if self.checkRepetend():\n",
    "                print(\"Stopped after %s iterations. Found period = %s\"%(i+1,self.period))\n",
    "                break\n",
    "              \n",
    "    def plotPopulation(self):\n",
    "        \"绘制人口曲线\"\n",
    "        plot([a.sum() for a in self.result])\n",
    "        plt.show()\n",
    "        \n",
    "    def static_analyse(self, ind):\n",
    "        im = l.result[ind]\n",
    "        idim = to_id_image(im)\n",
    "        \n",
    "        neipairs = neiPairsOf(idim, shift=self.shift)\n",
    "        points = np.unique(idim[idim!=-1])\n",
    "        \n",
    "        groups = partitEquivalence(neipairs, points).equivalence\n",
    "        return groups\n",
    "    \n",
    "    def plotGroup(self, imind, group):\n",
    "        plotGroup(self.result[imind], group)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 6,
   "metadata": {
    "collapsed": true,
    "jupyter": {
     "outputs_hidden": true
    }
   },
   "outputs": [],
   "source": [
    "toImage = lambda arr: Image.fromarray(0xff-arr.astype(np.uint8)*0xff, mode=\"L\")\n",
    "def saveGIF(fn, re, duration=250):\n",
    "    imlist = [toImage(r) for r in re[1:]]\n",
    "    toImage(re[0]).save(fn, save_all=True, append_images=imlist, duration=duration,\n",
    "                        optimize=True, minimize_size=True)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 40,
   "metadata": {
    "collapsed": true,
    "jupyter": {
     "outputs_hidden": true
    }
   },
   "outputs": [],
   "source": [
    "def neiPairsOf(idim, trans=-1, shift=None):\n",
    "\n",
    "    shift = shift or (lambda im,pairs:[np.roll(im,(d,r),axis=(0,1)) for d,r in pairs])\n",
    "    \n",
    "    def toNeiPairs(a, b):\n",
    "        a = a.reshape(-1, 1)\n",
    "        b = b.reshape(-1, 1)\n",
    "        pairs = np.hstack([a,b])\n",
    "        pairs = pairs[pairs[:,0] != trans]\n",
    "        pairs = pairs[pairs[:,1] != trans]\n",
    "        return pairs\n",
    "    \n",
    "    neiPairs = [toNeiPairs(idim, neimage) for neimage in shift(idim, [(1,0),(0,1),(1,1),(1,-1)])]\n",
    "        \n",
    "    return np.vstack(neiPairs)\n",
    "\n",
    "def to_id_image(im, transOld=0, transNew=-1):\n",
    "    idim = np.arange(im.ravel().shape[0]).reshape(im.shape)\n",
    "    idim[im==transOld] = transNew\n",
    "    return idim\n",
    "\n",
    "def toCoords(ids, shape):\n",
    "    ids = array(ids)\n",
    "    m,n = shape\n",
    "    r = ids // n\n",
    "    c = ids % n\n",
    "    return np.column_stack([r,c])\n",
    "\n",
    "def plotGroup(im, group):\n",
    "    plt.imshow(im)\n",
    "    \n",
    "    yx = toCoords(list(group), im.shape)\n",
    "    plot(yx[:,1],yx[:,0],'r.')\n",
    "    plt.show()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 8,
   "metadata": {
    "collapsed": true,
    "jupyter": {
     "outputs_hidden": true
    }
   },
   "outputs": [],
   "source": [
    "def delta(axis, neisum):\n",
    "#     neisum[im==0] = 0\n",
    "    neisNum = neisum.sum(axis=(1,0)[axis])\n",
    "    mask = neisNum == neisNum.min()\n",
    "    print(mask)\n",
    "    mininds = np.arange(len(mask))[mask]\n",
    "    print(mininds)\n",
    "    indpairs = np.zeros((len(mininds),2), dtype=int)\n",
    "    indpairs[:, axis] = mininds\n",
    "    shiftdis = -1-neisNum.argmin()\n",
    "    d = np.zeros(2, dtype=int)\n",
    "    d[axis] = shiftdis\n",
    "    return indpairs#d"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 9,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "[False False  True False False  True False]\n",
      "[2 5]\n"
     ]
    },
    {
     "data": {
      "text/plain": [
       "array([[0, 2],\n",
       "       [0, 5]])"
      ]
     },
     "execution_count": 9,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "delta(1,array([[5,4,1,6,7,1,8]]*2))"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 10,
   "metadata": {
    "collapsed": true,
    "jupyter": {
     "outputs_hidden": true
    }
   },
   "outputs": [],
   "source": [
    "def replacement(im, axis, shift=None):\n",
    "    \"\"\"\n",
    "    将图片重新置放\n",
    "    规则，循环（maybe，取决于shift函数）移动图片，使边界落在在邻胞最少处\n",
    "    axis: 取值0,1或（0,1）\n",
    "    \"\"\"\n",
    "    shift = shift or (lambda im,pairs:[np.roll(im,(d,r),axis=(0,1)) for d,r in pairs])\n",
    "    \n",
    "    neisDict = {0:[(-1,-1),(-1,0),(-1,1)], 1:[(-1,-1),(0,-1),(1,-1)],\n",
    "                (0,1):[(-1,-1),(-1,0),(-1,1),(0,-1),(1,-1)]}\n",
    "    \n",
    "    neis = neisDict[axis]\n",
    "    neis = shift(im, neis)\n",
    "\n",
    "    def delta(axis, neis):\n",
    "        neissum = sum(neis)\n",
    "        neissum[im==0] = 0\n",
    "        neisNum = neissum.sum(axis=(1,0)[axis])\n",
    "        minind = neisNum.argmin()\n",
    "        d = np.array([0,0])\n",
    "        d[axis] = -1 - minind            \n",
    "        return d\n",
    "    \n",
    "    \n",
    "    if axis == 0 or axis == 1:\n",
    "        d = delta(axis, neis)\n",
    "    elif axis == (0,1):\n",
    "        d = delta(0, neis[:3]) + delta(1, neis[3:])\n",
    "    \n",
    "    return d"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 11,
   "metadata": {
    "collapsed": true,
    "jupyter": {
     "outputs_hidden": true
    }
   },
   "outputs": [],
   "source": [
    "def coToIm(c):\n",
    "    ul = c.min(axis=0)\n",
    "    lr = c.max(axis=0)\n",
    "    shape = lr - ul\n",
    "    c = c - ul\n",
    "\n",
    "    im = np.zeros(shape+1)\n",
    "    im[(*c.T,)] = 1\n",
    "    return im\n",
    "\n",
    "def imageOf(coords, border, shift=None):\n",
    "    ymin, xmin = coords.min(axis=0)\n",
    "    ymax, xmax = coords.max(axis=0)\n",
    "    \n",
    "    axisCode = 0\n",
    "    if xmin == 0 and xmax == border[1]-1:\n",
    "        axisCode += 1\n",
    "    if ymin == 0 and ymax == border[0]-1:\n",
    "        axisCode += 2\n",
    "    if axisCode:\n",
    "        im = coToIm(coords)\n",
    "        d = replacement(im, {1:1,2:0,3:(0,1)}[axisCode])\n",
    "        \n",
    "        coords = coords + d\n",
    "        coords[coords[:,0]<0, 0] += border[0]\n",
    "        coords[coords[:,1]<0, 1] += border[1]\n",
    "\n",
    "    return coToIm(coords)"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "* survivalWin=(2,3),ini_dens=0.3  标准  \n",
    "* survivalWin=(0,2),ini_dens=0.01 闪烁  \n",
    "* survivalWin=(0,1),ini_dens=0.01 随机无尽  \n",
    "10000循环节捕获失败,wordSize=(15,15)  更正:其实是很难冷却，after gen=158495,有period=4，此时往往是随机到了细胞数过少的情况（已灭绝或简单模式），若人为补充细胞仍能回到系统性的无尽随机中；当wordSize足够大，细胞过少情况不易发生。  \n",
    "* survivalWin=(1,3),ini_dens=0.01 细胞生长, also survivalWin=(0,3)."
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 49,
   "metadata": {},
   "outputs": [],
   "source": [
    "l = lifegame(wordSize=(50,100), survivalWin=(1,3),ini_dens=0.4,boundaryType=\"circle\",\n",
    "             partrol_len=(10,20,40))"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 50,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "Stopped after 36 iterations. Found period = 6\n"
     ]
    }
   ],
   "source": [
    "l.iterition()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 51,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "'37 frames, period=6, 2193 cells left.'"
      ]
     },
     "execution_count": 51,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "if not l.period:\n",
    "    l.iterition(20000)\n",
    "\"%s frames, period=%s, %s cells left.\"%(len(l.result),l.period,l.result[-1].sum())"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 52,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "128 groups\n",
      "group_1 has max size 329\n"
     ]
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     "metadata": {},
     "output_type": "display_data"
    },
    {
     "data": {
      "image/png": "iVBORw0KGgoAAAANSUhEUgAAAW8AAADHCAYAAADWBNIjAAAABHNCSVQICAgIfAhkiAAAAAlwSFlz\nAAALEgAACxIB0t1+/AAAADl0RVh0U29mdHdhcmUAbWF0cGxvdGxpYiB2ZXJzaW9uIDIuMS4wLCBo\ndHRwOi8vbWF0cGxvdGxpYi5vcmcvpW3flQAAIABJREFUeJztnXGMHNd9379ze8fQPStCSFFCaREV\nu7l9MuhUEZz4aNOJKEKmpVgpBQFJAcFuEyMJHLCAawhoakP+o0WKAmliIUHhKpDg2gkrFIgiyYgA\nMYJDUpcovSMSSK3FkI+XE61aOjclGCsMz5F95E7/2J29N7Pz3rx582b2ze33AxCY3Tfz3pu53ceZ\n735/v18UxzEIIYS0i5lJT4AQQkh5uHgTQkgL4eJNCCEthIs3IYS0EC7ehBDSQrh4E0JIC5l1OUgI\nMQPgywDuAvB9AL8kpfxrnxMjhBCix2nxBvAQgJ1Syg8LIQ4C+C0Ax3Q7d+b2xgDwv149hbvuPpJq\ne3f9T0fbO/f+VPr9axuI5CpisYCdvftzjzFRqj9Nm2+Suc/+yD5c/+63axsny9i18NBms5/6vo68\nz4Utxs+PZn6648v0UfYcbSm6FqZxbb8XKq5z141lmpPtZymhynfE9m/l8vlx/Vy4jHVjcz2CBtfF\n+6MATgKAlHJZCPETNgd94AN32o9wbQOzH38Y0eoa4oUu5uM+NqIKKo+pP99jWRDN7qi1/zZR6nOx\nzeG12ILfETORS4SlEOIpAH8opXxx+Pr/APinUsrrefu//vqFuPSHcmUFOHhw6/XyMrC4WHquVv35\nHosQQvzg/c77KoCblNczuoUbAMRtc9i8vIa5PV105vam2rSPEhdPYra7H9HaJcTd/bj50LFKd8Om\n/oxtDo+iWfIeTW9sro9dC9/4fiSsOm5e/wAwt6eLzctrpcfJ67/snOp+PC5Lme+Ib2xlMdNxtlKB\nDWW+I76ljDpwlE20/bmuhq8A+BkAGGre33TshxBCiAO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PAJiVUn4EwH8A8B8xvdfCiqYW748COAkAUsplAD/R0Lih8AcAvqi8vg7ggxjc\nZQHAiwDua3pSE+I3ATwBIEnaMK3XAQA+DuCbAJ4D8EcAXsD0Xo+LAGaHT+k/DGAT03strGhq8f5h\nAH+nvL4hhJiaGHQp5TUp5d8LIW4C8AyAxwBEUsokQurvAdw8sQk2hBDiFwBcllL+sfL21F0HhVsw\nuJH5OQCfAfDfAcxM6fW4hoFkcgHAkwB+B9P92SikqcX7KoCb1HGllFOV/UkIsQ/AaQC/L6V8GoCq\n3d0E4J2JTKxZPg3gY0KIMwB+HMDvAbhVaZ+W65BwBcAfSyl/IKWUAN5FeoGapuvxOQyuRQ+D38a+\nBqSqmUzTtbCiqcX7FQw0LQghDmLwqDg1CCFuA/ASgF+TUn5l+ParQ80TGOjg7ckx6oiU8qellPdI\nKQ8DeA3AvwTw4rRdB4U/A3C/ECISQuwFMA/gT6b0enwXW0/nfwtgDlP4HSlDI7lNFLfJP8Pgh4df\nlFJeqH3gQBBC/DaAf4HBI2HCZzF4NNwB4DyAX5ZS3pjA9CbC8O77Mxg8gTyJ6b0OvwHgXgxupL4A\n4BKm8HoIId6LgSPrH2Nw7r8N4C8whdfCFiamIoSQFsIgHUIIaSFcvAkhpIVw8SaEkBbCxZsQQloI\nF29CCGkhXLwJIaSFcPEmhJAWwsWbEEJayP8HBe2epo+vDYoAAAAASUVORK5CYII=\n",
      "text/plain": [
       "<matplotlib.figure.Figure at 0x20ff0500550>"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    }
   ],
   "source": [
    "ind = -1\n",
    "groups = l.static_analyse(ind)\n",
    "print(len(groups),\"groups\")\n",
    "groupsize = [len(g) for g in groups]\n",
    "maxgroup = max(enumerate(groupsize), key=lambda x:x[-1])\n",
    "print(\"group_%s has max size %s\"%maxgroup)\n",
    "\n",
    "l.plotPopulation()\n",
    "# plt.subplot(121)\n",
    "# plt.imshow(l.result[-1])\n",
    "# plt.subplot(122)\n",
    "l.plotGroup(ind, groups[maxgroup[0]])"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 53,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "(49, 32)"
      ]
     },
     "execution_count": 53,
     "metadata": {},
     "output_type": "execute_result"
    },
    {
     "data": {
      "image/png": "iVBORw0KGgoAAAANSUhEUgAAAK4AAAD5CAYAAAC+hw6hAAAABHNCSVQICAgIfAhkiAAAAAlwSFlz\nAAALEgAACxIB0t1+/AAAADl0RVh0U29mdHdhcmUAbWF0cGxvdGxpYiB2ZXJzaW9uIDIuMS4wLCBo\ndHRwOi8vbWF0cGxvdGxpYi5vcmcvpW3flQAACxtJREFUeJzt3V2IXPUZx/HvZDuaXmwklGgJFQOR\nPr0Q0qJgRNMuJblIIUS86JWhTRERFCIEbJWkV0Kx1VxoCZZI1Ba8qNV4pxUao6JYsGyDQfsUA71a\nEBGisVbZ3UwvZqY9WWbmvMx5e2Z/n6udlz3nv+PPf57/nJen0+v1EIlmQ9MDEClCwZWQFFwJScGV\nkBRcCUnBlZC+VuSXzGwDcBzYAXwF3OXuH5Y5MJFJCgUXuB3Y6O63mNlO4DFg/7g3z3W3/u/L4rOL\np9nxvR8W2umXS29e9njj1l2FtpPHNONtQrTxwuQxry4vdUY9X7RUuA14BcDd3wFuyvqLN9zwnYK7\nbIbGW70iYy4a3E3Ap4nHq2ZWdPYWya1o2D4D5hOPN7j7yrg3n108fdn/VavLSwV3e7myttOW/ZQl\n2nhh9JjnulvHvr9ocN8C9gF/HNS47016c7J+WV1emjigSZqocacZbxOS4137edUpz3+bIp9x0eCe\nAvaY2dtABzhYcDsihRQKrrtfAu4peSwimekAhISk4EpI+gqrYnUtkEYthupYvI4z6u8uczyacSUk\nBVdCUnAlJNW4Nauz7mzigE1dNONKSAquhKTgSkgKroRUy+Js7SIhy5fyWRYSZX25P2pfyW1/ufRm\nZQubKv+GWaYZV0JScCUkBVdCqqXGTdZfq8tLhevXtteZo6wdc1UHBdbW5Fn2XaWqa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463f28>"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    }
   ],
   "source": [
    "coords = toCoords(list(groups[maxgroup[0]]), l.wordSize)\n",
    "gim = imageOf(coords, l.wordSize, shift=l.shift)\n",
    "plt.imshow(gim)\n",
    "gim.shape"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 48,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "'33_2_389_w13.gif'"
      ]
     },
     "execution_count": 48,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "fn = \"%s_%s_%s_w%s%s.gif\"%(len(l.result),l.period,l.result[-1].sum(),*l.survivalWin)\n",
    "l.saveGIF(fn)\n",
    "fn"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 26,
   "metadata": {
    "collapsed": true,
    "jupyter": {
     "outputs_hidden": true
    }
   },
   "outputs": [],
   "source": [
    "for i,r in enumerate(l.result):\n",
    "    pass#plt.imsave(fname=r\"D:\\livegame\\%s.png\"%i,arr = r)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 27,
   "metadata": {},
   "outputs": [],
   "source": [
    "saveGIF(\"rrrr.gif\",l.result[-1000:],duration=200)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 28,
   "metadata": {},
   "outputs": [],
   "source": [
    "plt.imsave(fname=r\"result-1.png\",arr = l.result[-1])"
   ]
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "Python 3",
   "language": "python",
   "name": "python3"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 3
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython3",
   "version": "3.7.4"
  },
  "toc": {
   "colors": {
    "hover_highlight": "#DAA520",
    "navigate_num": "#000000",
    "navigate_text": "#333333",
    "running_highlight": "#FF0000",
    "selected_highlight": "#FFD700",
    "sidebar_border": "#EEEEEE",
    "wrapper_background": "#FFFFFF"
   },
   "moveMenuLeft": true,
   "nav_menu": {
    "height": "49px",
    "width": "252px"
   },
   "navigate_menu": true,
   "number_sections": true,
   "sideBar": true,
   "skip_h1_title": false,
   "threshold": 4,
   "toc_cell": false,
   "toc_section_display": "block",
   "toc_window_display": false,
   "widenNotebook": false
  },
  "varInspector": {
   "cols": {
    "lenName": 16,
    "lenType": 16,
    "lenVar": 40
   },
   "kernels_config": {
    "python": {
     "delete_cmd_postfix": "",
     "delete_cmd_prefix": "del ",
     "library": "var_list.py",
     "varRefreshCmd": "print(var_dic_list())"
    },
    "r": {
     "delete_cmd_postfix": ") ",
     "delete_cmd_prefix": "rm(",
     "library": "var_list.r",
     "varRefreshCmd": "cat(var_dic_list()) "
    }
   },
   "types_to_exclude": [
    "module",
    "function",
    "builtin_function_or_method",
    "instance",
    "_Feature"
   ],
   "window_display": false
  }
 },
 "nbformat": 4,
 "nbformat_minor": 4
}
